from rest_framework.serializers import ModelSerializer
from .models import *
from rest_framework.serializers import StringRelatedField


class DepaSer(ModelSerializer):
    class Meta:
        model = Department
        fields = '__all__'


class UserSer(ModelSerializer):
    class Meta:
        model = User
        fields = '__all__'


class SUserSer(ModelSerializer):
    depa = DepaSer()

    class Meta:
        model = User
        fields = '__all__'


class BcateSer(ModelSerializer):
    class Meta:
        model = Bcate
        fields = '__all__'


class BookSer(ModelSerializer):
    cate = BcateSer()

    class Meta:
        model = Book
        fields = '__all__'


class SsuserSer(ModelSerializer):
    class Meta:
        model = RedisUser
        fields = '__all__'


class NewsSer(ModelSerializer):
    class Meta:
        model = News
        fields = '__all__'


class CateSer(ModelSerializer):
    class Meta:
        model = Cate
        fields = '__all__'


class ShopSer(ModelSerializer):
    class Meta:
        model = Shop
        fields = '__all__'


class ShowShopSer(ModelSerializer):
    cate = CateSer()

    class Meta:
        model = Shop
        fields = '__all__'


class CouseSer(ModelSerializer):
    class Meta:
        model = Couse
        fields = '__all__'


class SclassSer(ModelSerializer):
    couse = CouseSer(read_only=True, many=True)

    class Meta:
        model = Sclass
        fields = '__all__'


class CuserSer(ModelSerializer):
    class Meta:
        model = Cuser
        fields = '__all__'


class SCuserSer(ModelSerializer):
    cla = SclassSer()

    class Meta:
        model = Cuser
        fields = '__all__'


class Day13UserSer(ModelSerializer):
    class Meta:
        model = Day13User
        fields = '__all__'


class Day13ShopSer(ModelSerializer):

    class Meta:
        model = Day13Shop
        fields = '__all__'


class SDay13UserSer(ModelSerializer):
    shop = Day13ShopSer(read_only=True, many=True)

    class Meta:
        model = Day13User
        fields = '__all__'
